import Vue from "vue"
import home from "./components/home.vue"
import router from "./router"
import axios from "axios"

Vue.prototype.$axios = axios
axios.defaults.baseURL = 'http://serverexam2531.cn.utools.club/';


Vue.filter("dateFormat", (date, pattern = '') => {
    let dt = new Date(date);
    let y = dt.getFullYear();
    let m = (dt.getMonth() + 1).toString().padStart(2, '0');
    let d = dt.getDate().toString().padStart(2, '0');

    if (pattern.toLowerCase().trim() === "yyyy-mm-dd") {
        return `${y}-${m}-${d}`;
    } else {
        let hh = dt.getHours().toString().padStart(2, '0');
        let mm = dt.getMinutes().toString().padStart(2, '0');
        let ss = dt.getSeconds().toString().padStart(2, '0');
        return `${y}-${m}-${d} ${hh}:${mm}:${ss}`;
    }
})


new Vue({
    el: "#app",
    data: {},
    render: val => val(home),
    router
})
